package cate.common.table.guild.fairyland.base;

import cate.common.table.EExcelRowClass;
import cate.common.table.ESheet;
import easy.java.dev.note.NoteField;

import java.util.HashMap;
import java.util.Map;

@EExcelRowClass(note = "公会秘境-公会秘境BOSS关卡 Sheet")
public class GuildFairyBaseSheet extends ESheet<GuildFairyBaseRow> {
    @Override
    public String getSheetName() {
        return "公会秘境BOSS关卡";
    }

    @NoteField("最大BOSS序号")
    public Map<Integer, Integer> bossMaxIndex = new HashMap<>();

    @Override
    public void decode() {
        super.decode();
        getList().forEach(row -> {
            if (!bossMaxIndex.containsKey(row.bossType) || bossMaxIndex.get(row.bossType) < row.bossLevel) {
                bossMaxIndex.put(row.bossType, row.bossLevel);
            }
        });
    }

    /**
     * 获取单个BOSS类型最高等级
     *
     * @param bossType BOSS类型
     */
    public int getMaxLevel(int bossType) {
        return bossMaxIndex.getOrDefault(bossType, 1);
    }
}
